package com.linzm.behavioraltype.strategy10;

import com.linzm.behavioraltype.strategy10.strategy.OperationAdd;
import com.linzm.behavioraltype.strategy10.strategy.OperationMultiply;
import com.linzm.behavioraltype.strategy10.strategy.OperationSubtract;

/**
 * @Author zimingl
 * @Date 2023/4/16 13:46
 * @Description: StrategyPatternDemo
 */
public class StrategyPatternDemo {
    public static void main(String[] args) {
        Context context = new Context(new OperationAdd());
        System.out.println("10 + 5 = " + context.executeStrategy(10, 5));

        context = new Context(new OperationSubtract());
        System.out.println("10 - 5 = " + context.executeStrategy(10, 5));

        context = new Context(new OperationMultiply());
        System.out.println("10 * 5 = " + context.executeStrategy(10, 5));
    }
}
